https://github.com/rbgirshick/py-faster-rcnn/issues/161
R-CNN for Small Object Detection: https://www.merl.com/publications/docs/TR2016-144.pdf
Perceptual Generative Adversarial Networks for Small Object Detection https://arxiv.org/pdf/1706.05274v1.pdf
https://github.com/rbgirshick/py-faster-rcnn/issues/86
https://github.com/rbgirshick/py-faster-rcnn/issues/433
Hi, I had the same problem and those are my conclusion at this point :
To me, the best answer was to cut the images in smaller patches, at least for the training phase. According to hardware requirement, you need :
3GB GPU memory for ZF net
8GB GPU memory for VGG-16 net
That’s taking into account the 600x1000 original scaling, so to make it simple you need 8GB for 600 000 pixels assuming that you use VGG.
I have 12GB on my GPU so if this is linear, i can go up to (600 000x12)/8 = 900 000 pixels maximum.
I couldn’t resize my images because my objects are small and I couldn’t afford losing resolution.
I chose to cut my 3000x4000 images in 750x1000 patches, which is the simplest division to go under 900 000 pixels.
SCALES: [750]
MAX_SIZE: 1000
However, the good thing is that you only need to cut the images for the training phase. Then you can apply the trained network on full images thanks the the separate test parameters :
TEST:
SCALES: [3000]
MAX_SIZE: 4000
At least that’s what I did and now I have a network working on 3000x4000 images to detect 100x100 objects, in full c++ thanks to the c++ version.
Hi guys,
I already changed the code in lib/rpn/generate_anchors.py and nub_output like this:
ratios and num_output like this
However, I got the following error.
==============
layer {
name: 'rpn_cls_prob_reshape'
type: 'Reshape'
bottom: 'rpn_cls_prob'
top: 'rpn_cls_prob_reshape'
reshape_param { shape { dim: 0 dim: 18 dim: -1 dim: 0 } }
}
You should change this 18 to 24
JayMarx
Hello! Do you solve the problem? I changed aspect ratios and followed catsdogone’s method, it’s works, but when I changed scales just like you, it didn’t work.Do you have any idea how to fix it?
These are my changes:
As you see, I just changed “dim: 18” to “dim: 140” and I don’t know whether it’s right or not!
The error goes like this:
->>>
liuhyCV
@JayMarx I have meet the same error with you. I have found the solutions as follows:
at function “ def generate_anchors(base_size=16, ratios=[0.3, 0.5, 1, 1.5, 2], scales=2**np.arange(1, 6)): “,
but at anchor_target_layer.py:
def setup(self,bottom,top)
layer_params = yaml.load(self.param_str_)
anchor_scales =layer_params.get('scales', (8, 16, 32))
self._anchors = generate_anchors(scales=np.array(anchor_scales))
we should change this code by:
layer_params = yaml.load(self.param_str_)
anchor_scales =layer_params.get('scales', (8, 16, 32))
self._anchors = generate_anchors()
at last the generate_anchors() can use the scales that we defintion
@harjatinsingh So far I havent being able to successfully make it work for smaller images as I wanted. However, it seems changing the values of the ratios in generate_anchors.py does make the algorithm to recognize smaller objects, but the bounding box looses precision. For instance, what I have done is changing the code below from this:
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=2**np.arange(3, 6)):
to this:
def generate_anchors(base_size=16, ratios=[0.3, 0.75, 1], scales=2**np.arange(3, 6)):
Also, it seems that changing the values of anchors does work as noted in #161 but I couldnt make it work for me. So my question (in both issues) is still pending.